Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
eslint-config-google
Advanced tools
The eslint-config-google package provides a shareable ESLint configuration that follows the Google JavaScript style guide. It helps developers enforce consistent coding styles and best practices as defined by Google.
Enforcing Google JavaScript Style Guide
By extending the 'google' configuration, ESLint will enforce the coding standards and best practices defined in the Google JavaScript style guide. This includes rules for indentation, quotes, semicolons, and more.
{
"extends": "google"
}
Customizable Rules
You can customize the rules provided by the Google configuration to better fit your project's needs. For example, you can change the quote style to single quotes and set the indentation to 2 spaces.
{
"extends": "google",
"rules": {
"quotes": ["error", "single"],
"indent": ["error", 2]
}
}
The eslint-config-airbnb package provides a shareable ESLint configuration based on the Airbnb JavaScript style guide. It is one of the most popular ESLint configurations and includes rules for React as well. Compared to eslint-config-google, it has a broader set of rules and is widely adopted in the JavaScript community.
The eslint-config-standard package provides a shareable ESLint configuration based on JavaScript Standard Style. It focuses on simplicity and minimalism, enforcing a set of rules that aim to reduce cognitive overhead. Unlike eslint-config-google, it does not follow a specific company's style guide but rather a community-driven standard.
The eslint-config-prettier package turns off all ESLint rules that are unnecessary or might conflict with Prettier. It is often used in conjunction with other ESLint configurations to ensure that code formatting is handled by Prettier while ESLint focuses on code quality. This package complements eslint-config-google by allowing developers to use Prettier for formatting while still adhering to Google's style guide.
ESLint shareable config for the Google JavaScript style guide (ES2015+ version)
$ npm install --save-dev eslint eslint-config-google
Once the eslint-config-google
package is installed, you can use it by specifying google
in the extends
section of your ESLint configuration.
{
"extends": "google",
"rules": {
// Additional, per-project rules...
}
}
google
config with eslint:recommended
There are several rules in the eslint:recommended
ruleset that Google style is not opinionated about that you might want to enforce in your project.
To use Google style in conjunction with ESLint's recommended rule set, extend them both, making sure to list google
last:
{
"extends": ["eslint:recommended", "google"],
"rules": {
// Additional, per-project rules...
}
}
To see how the google
config compares with eslint:recommended
, refer to the source code of index.js
, which lists every ESLint rule along with whether (and how) it is enforced by the google
config.
Apache-2 © Google
FAQs
ESLint shareable config for the Google style
We found that eslint-config-google demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.